from plone.app.testing import PloneSandboxLayer
from plone.app.testing import applyProfile
from plone.app.testing import PLONE_FIXTURE
from plone.app.testing import IntegrationTesting

from zope.configuration import xmlconfig

class PlumVillagePolicy(PloneSandboxLayer):
    defaultBases = (PLONE_FIXTURE,)
    def setUpZope(self, app, configurationContext):
        # Load ZCML
        import plumvillage.policy
        xmlconfig.file('configure.zcml',
                plumvillage.policy,
                context=configurationContext
            )
    def setUpPloneSite(self, portal):
        applyProfile(portal, 'plumvillage.policy:default')
    
PLUMVILLAGE_POLICY_FIXTURE = PlumVillagePolicy()
PLUMVILLAGE_POLICY_INTEGRATION_TESTING = IntegrationTesting(
        bases=(PLUMVILLAGE_POLICY_FIXTURE,),
        name="PlumVillage:Integration"
    )
